#include <stdio.h>
#include <cstdlib> 
#include <errno.h>
#include <csp_debug.h>
#include <ProcessComposition.h>
#include <ProcessQueue.h>

void ProcessQueue::push(ProcessComposition &p) {					
	if (first==NULL) 
		last=first=&p;
	else {
		last->next=&p;
		last=&p;
	}
	s++;
}

ProcessComposition & ProcessQueue::pop() {							
	ProcessComposition *oldFirst=first;
	s--;
	first=first->next;
	oldFirst->next = NULL;
	return *oldFirst;
}

int ProcessQueue::size(){
	return s;
}

ProcessQueue::ProcessQueue() {
	first=last=NULL;
	s = 0;
}

ProcessQueue::~ProcessQueue() {	
}


